package org.bdware.irs.server.tcp;

import org.apache.log4j.Logger;
import org.bdware.irp.irpserver.*;
import org.bdware.irs.IrsBootWithTcp;
import org.bdware.irs.IrsConfig;
import org.bdware.irs.backend.servicesImpl.BDIrsStorageImpl;
import org.bdware.irs.irp.handle.IrsTCPHandlerImpl;

import java.util.ArrayList;
import java.util.List;

public class IrpServerMain {

    static Logger logger = Logger.getLogger(IrpServerMain.class);
    static IrsHandler irsHandler;
    static BDIrsStorageImpl store;





    public static void main(String[] args) {


        IrpListenerInfo listenerInfo = new IrpListenerInfo("TCP");

        List<IrpListenerInfo> listenerInfos = new ArrayList<IrpListenerInfo>();
        listenerInfos.add(listenerInfo);
        IrpServerInfo info = new IrpServerInfo(IrsBootWithTcp.irsConfig.port, listenerInfos);


        store = new BDIrsStorageImpl();
        irsHandler = new IrsTCPHandlerImpl(info, store);


        IrpServer server = IrpServerImpl.createIrpServer(info);
        server.setIrsServerHandler(irsHandler);
        server.start();
    }

    public static BDIrsStorageImpl getStore(){
        return store;
    }


    public static IrsHandler getIrsHandle(){
        return irsHandler;
    }
}



